package com.dahong.cloud.server.controller;

import cn.hutool.json.JSONUtil;
import com.lambda.cloud.core.principal.LoginUser;
import com.lambda.cloud.core.utils.OperatorUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/server")
public class TestServerController {

    @GetMapping("/hi")
    public String getHi() {
        LoginUser operator = OperatorUtils.getOperator();
        System.out.println(JSONUtil.toJsonPrettyStr(operator));
        return "hi 我是 demo-server 服务 当前登录用户：" + operator.getName() + "\n" + JSONUtil.toJsonPrettyStr(operator);
    }
}
